package com.wshl.aijiuunion.view.adapter;

import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;

import com.wshl.aijiuunion.NetUrl;
import com.wshl.aijiuunion.R;
import com.wshl.aijiuunion.utils.GlideUtils;
import com.wshl.aijiuunion.view.bean.CommentListbean;

import cn.bingoogolapple.baseadapter.BGARecyclerViewAdapter;
import cn.bingoogolapple.baseadapter.BGAViewHolderHelper;
import cn.bingoogolapple.photopicker.widget.BGAImageView;

public class CommentAdapter extends BGARecyclerViewAdapter<CommentListbean.DataBeanX.DataBean> {
    public CommentAdapter(RecyclerView recyclerView) {
        super(recyclerView, R.layout.item_pinglun);
    }

    @Override
    protected void fillData(BGAViewHolderHelper helper, int position, CommentListbean.DataBeanX.DataBean model) {

        helper.setText(R.id.tv_nickname, model.getName());
        helper.setText(R.id.tv_pinglun_content, model.getContent());
        BGAImageView imageView = (BGAImageView) helper.getImageView(R.id.bga_kecheng_detail);
        String url = "";
        String avatar = model.getAvatar();
        if (avatar.contains("http")) {
            url = avatar;
        } else {
            url = NetUrl.IMG + avatar;
        }
        GlideUtils.loadImage(mContext, url, imageView);
    }


}
